package com.vancouver.knows.ui.fragment.homePage;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import butterknife.Bind;
import butterknife.ButterKnife;

import com.vancouver.knows.R;
import com.vancouver.knows.ui.activity.login.LoginActivity;
import com.vancouver.knows.ui.activity.login.PhoneSecurityCodeActivity;

public class HomepageNotLoginView {
	private Context mContext;
	private LayoutInflater mInflater;
	private View mView;

	@Bind(R.id.login)
	TextView mLogin;
	@Bind(R.id.register)
	TextView mRegister;

	public HomepageNotLoginView(Context context, LayoutInflater inflater) {
		mContext = context;
		mInflater = inflater;
		findViewsId();
		setViews();
		setListeners();
	}

	private void findViewsId() {
		mView = mInflater.inflate(R.layout.login_or_register, null);
		ButterKnife.bind(this, mView);
	}

	private void setListeners() {

	}

	private void setViews() {
		mLogin.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				Intent intent = new Intent(mContext, LoginActivity.class);
				mContext.startActivity(intent);
			}
		});

		mRegister.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				Intent intent = new Intent(mContext, PhoneSecurityCodeActivity.class);
				intent.putExtra("COMMON_TIPS", mContext.getString(R.string.phone_register).toString());
				mContext.startActivity(intent);
			}
		});

	}

	public View getLoginOrRegisterView() {
		return mView;
	}
}